Skip to content

fix(admin_audit): handle audit reads for new files - #63305

Merged
come-nc merged 5 commits into
masterfrom
jtr/fix-auditLog-files-null
Aug 18, 2026
Merged

fix(admin_audit): handle audit reads for new files#63305
come-nc merged 5 commits into
masterfrom
jtr/fix-auditLog-files-null

Conversation

@joshtrichards

Copy link
Copy Markdown
Member
  • Resolves: #

Summary

Handle audit logging for file reads that occur before a new file has been assigned a file ID.

BeforeNodeReadEvent can provide a NonExistingFile without an ID. Although #47071 avoided calling getId() for this case, Action::log() still treated the resulting parameter as missing because it used !isset(). As a result, the intended audit entry was not written.

Changes:

  • Use not-yet-assigned as the audit ID for NonExistingFile reads.
  • Treat explicitly provided null values as valid audit parameters.
  • Clarify Action::log() parameter validation and formatting.
  • Support both DateTime and DateTimeImmutable through DateTimeInterface.
  • Contraint onAction::log() with PHPDoc to values that can be safely normalized and passed to vsprintf() without introducing a behavior change (static analysis only).
  • Avoid repeated node and source/target accessor calls in file actions as a small clarity and performance cleanup.

This preserves the audit event and makes the unavailable ID explicit in the log output:

File with id "not-yet-assigned" accessed: "..."

TODO

  • ...

Checklist

AI (if applicable)

  • The content of this PR was partly or fully generated using AI

Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
refactor(admin_audit): improve audit parameter handling

refactor(admin_audit): improve audit parameter handling

- clarify missing-parameter validation and logging;
- support DateTimeInterface values;
- simplify the vsprintf invocation.

Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
And align event handlers for consistency.

Signed-off-by: Josh <josh.t.richards@gmail.com>
@joshtrichards
joshtrichards requested a review from a team as a code owner August 17, 2026 00:24
@joshtrichards
joshtrichards requested review from Altahrim, CarlSchwan, come-nc and leftybournes and removed request for a team August 17, 2026 00:24
@CarlSchwan CarlSchwan added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Aug 17, 2026
@come-nc
come-nc merged commit 231ec67 into master Aug 18, 2026
251 of 265 checks passed
@come-nc
come-nc deleted the jtr/fix-auditLog-files-null branch August 18, 2026 07:48
@nextcloud-bot nextcloud-bot mentioned this pull request Aug 18, 2026
@joshtrichards joshtrichards added this to the Nextcloud 35 milestone Aug 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants